//////////Change the directory before running the code
//////// Reduced-form regression
cd "D:\data&code"
use pseudo_dataset/voting, clear
keep if contest == 1


////// No fund fixed effects
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f 						///
		hf  							///
		no_camp 						///
		share_intensity 				///
		passive 						///
		log_port_val 					///
		port_share						///	
		horizon 						///
		basis_ret                   	///
		, 								///
		absorb(proxy_year ff48) 		///
		vce(cluster fund_family_id)
		
outreg2 using table_4,  						///
        dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			passive 							///
			log_port_val 						///
			port_share							///	
			horizon 							///
			basis_ret 							/// 
		)               						/// 
		replace		
			
/////// Fund fixed effects
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f 						///
		hf  							///
		no_camp 						///
		share_intensity  				///
		log_port_val 					///
		port_share						///	
		horizon 						///
		basis_ret               		///
		, 								///
		absorb(proxy_year ff48 fund_id) ///
		vce(cluster fund_family_id)
		
outreg2 using table_4,  						///
        dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			log_port_val 						///
			port_share							///		
			horizon 							///
			basis_ret 							/// 
		)               						/// 
		append	
	
/////// Event fixed effects, no fund FE
reghdfe vote_num   						///
		passive 						///
		log_port_val 					///
		port_share						///	
		horizon 						///
		basis_ret               		///
		, 								///
		absorb(pf_no) 				    ///
		vce(cluster fund_family)

outreg2 using table_4,  						///
        dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			passive 							///
			log_port_val 						///
			port_share							///		
			horizon 							///
			basis_ret 							/// 
		)               						/// 
		append			

///// Browse and clean up
use table_4_dta, clear
rm table_4.txt
browse



